import java.util.StringTokenizer;

class ICPCP3157_7752 {

    public static void main(String[] args) {
    	
    	
    	while (true) {
    		String line = readLn();
    		StringTokenizer st = new StringTokenizer(line);
    		
    		int N = Integer.parseInt(st.nextToken());
    		int M = Integer.parseInt(st.nextToken());
    		
    		if (N == 0 && M == 0) break;
    		
    		process(N, M);
    		
    	}
    	
    }

    private static void process(int n, int m) {
    	
    	int[] players = new int[10001];
    	int[] players1 = new int[10001];
    	
    	for (int k = 0; k < n; k++) {
    		StringTokenizer st = new StringTokenizer(readLn());
    		for (int j = 0; j < m; j++) {
    			int player = Integer.parseInt(st.nextToken());
    			players[player]++;
    			players1[player]++;
    		}
    	}
    	
    	sort(players, 1, 10000);
    	
    	int secondBest = players[2];
    	
    	StringBuffer sb = new StringBuffer();
    	for (int k = 1; k < players.length; k++) {
    		if (players1[k] == secondBest) {
    			sb.append(k + " ");
    		}
    	}
    	
    	System.out.println(sb.toString());
    	
    	
	}
    
    static void sort(int[] teams, int lo0, int hi0) {
		int lo = lo0;
		int hi = hi0;
		int mid;

		if (hi0 > lo0) {

			mid = teams[(lo0 + hi0) / 2];

			while (lo <= hi) {
				while ((lo < hi0) && ((teams[lo] > mid)))
					++lo;

				while ((hi > lo0) && ((teams[hi] < mid)))
					--hi;

				if (lo <= hi) {
					swap(teams, lo, hi);

					++lo;
					--hi;
				}
			}

			if (lo0 < hi)
				sort(teams, lo0, hi);

			if (lo < hi0)
				sort(teams, lo, hi0);

		}
	}


	private static void swap(int[] teams, int lo, int hi) {
		int aux = teams[lo];
		teams[lo] = teams[hi];
		teams[hi] = aux;
		
	}

	static String readLn() {
        String newLine = System.getProperty("line.separator");
        StringBuffer buffer = new StringBuffer();
        int car = -1;
        try {
            car = System.in.read();
            while ((car > 0) && (car != newLine.charAt(0))) {
                buffer.append((char)car);
                car = System.in.read();
            }
            if (car == newLine.charAt(0))
            System.in.skip(newLine.length() - 1);
        } catch (java.io.IOException e) { return (null);}
        if ((car < 0) && (buffer.length() == 0)) return (null);
        return (buffer.toString()).trim();
    }

}